import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.parser.CCJSqlParser;
import net.sf.jsqlparser.parser.StringProvider;
import net.sf.jsqlparser.statement.Statements;

public class SqlParser {
    String sqls = "delete from\tt_label_info using t_label_info\n" +
            "inner join \n" +
            "(\n" +
            "\tselect\n" +
            "\t\ts.sid as pid,\n" +
            "\t\tb.type,\n" +
            "\t\tb.risk_level\n" +
            "\tfrom\n" +
            "\t\t(\n" +
            "\t\tselect\n" +
            "\t\t\tsid,\n" +
            "\t\t\ttype,\n" +
            "\t\t\trisk_level\n" +
            "\t\tfrom\n" +
            "\t\t\tt_behaviour_buffer\n" +
            "\t\tgroup by\n" +
            "\t\t\tsid,\n" +
            "\t\t\ttype,\n" +
            "\t\t\trisk_level\n" +
            "        ) b\n" +
            "\tinner join t_suspect s on\n" +
            "\t\tb.sid = s.sid\n" +
            "\tgroup by\n" +
            "\t\ts.sid,\n" +
            "\t\tb.type,\n" +
            "\t\tb.risk_level) b on\n" +
            "\tt_label_info.pid = b.pid and t_label_info.label_code like '123'";

    public Statements test() throws JSQLParserException{
        CCJSqlParser parser = new CCJSqlParser(new StringProvider(sqls));
        try {
            return parser.Statements();
        } catch (Exception ex) {
            throw new JSQLParserException(ex);
        }
    }


    public static void main(String[] args) throws Exception{
        new SqlParser().test();
    }












}
